<?php

namespace App\Http\Models;

use Illuminate\Database\Eloquent\Model;

class ActionLogModel extends Model
{
	protected $connection = 'db_main';

	protected $table = 'wp_action_log';
	protected $fillable = ['action_id', 'remark', 'user_id', 'model', 'action_ip', 'create_time'];

	public $timestamps = false;

	public static function log($action_id, $remark, $model,  $uid = 0, $ip = '127.0.0.1')
	{
		self::create([
			'action_id' => $action_id,
			'remark' => $remark,
			'user_id' => $uid,
			'model' => 'm_'.$model,
			'action_ip' => ip2long($ip),
			'create_time'=> time()
		]);
	}

}

